<%@page import="java.util.List"%>

<%@include file="/header.jsp"%>
<%
    List<Users> users = (List<Users>) request.getAttribute("usersList");

%>

<div class="left_side">
    <jsp:include page="/blocks/conditionalLeftBar.jsp" />
</div>

<div class="right_side">
    <h2 class="content_title">Users: </h2>
    <div class="white_block" overflow="scroll">
        <h2 style="text-align: center;">User list: </h2>
        <table class="typycal_table">
            <thead>   
                <tr>
                    <th>ID</th>
                    <th>CREATION DATE</th>
                    <th>EMAIL</th>
                    <th>NAME</th>
                    <th>LAST NAME</th>
                    <th></th>
                    <th></th>
                </tr>
            </thead>
            <tbody>
                <%if (users != null) {
                        for (Users u : users) {
                %>
                <tr>
                    <td><%=u.getUsersId()%> </td>
                    <td><%=u.getCreationDate()%></td>
                    <td><%=u.getEmail()%></td>
                    <td><%=u.getFirstName()%></td>
                    <td><%=u.getSecondName()%></td>
                    <td>
                        <form method="post" action="editUser?userId=<%=u.getUsersId()%>">
                            <input type="submit" value="Edit" name="edit" />
                        </form>
                    </td>
                    <td>
                        <form method="post" class="disable_on_ckick" action="deleteUser?userId=<%=u.getUsersId()%>">
                            <input type="submit" value="Delete" name="delete" />
                        </form>
                    </td>
                </tr>

                <%                       }
                    }%>
            </tbody>
        </table>
    </div>  
    <jsp:include page="/blocks/pages.jsp">
        <jsp:param name="path" value="/admin/users" />
    </jsp:include>
</div>

<%@include file="/footer.jsp" %>